package com.ihc.android.datasource;

public class ClientQuiz {
	
	private long id;
	private Quiz quiz;
	private Device client;
	
	public ClientQuiz() {
	}
	
	public ClientQuiz(long id) {
		this(id, null, null);
	}
	
	public ClientQuiz(long id, Quiz quiz, Device client) {
		this.id = id;
		this.quiz = quiz;
		this.client = client;
	}
	
	public long getId() {
		return id;
	}
	
	public void setId(long id) {
		this.id = id;
	}
	
	public Quiz getQuiz() {
		return quiz;
	}
	
	public void setQuiz(Quiz quiz) {
		this.quiz = quiz;
	}

	public Device getClient() {
		return client;
	}
	
	public void setClient(Device client) {
		this.client = client;
	}
	
	@Override
	public String toString() {
		if (this.client != null) {
			return this.client.toString();
		} else {
			return Long.toString(this.getId());
		}
	}
	
	@Override
	public boolean equals(Object obj) {
		if (this == obj) return true;
		
		if ( !(obj instanceof ClientQuiz) ) return false;
		
		ClientQuiz cq = (ClientQuiz) obj;
		
		return ((this.quiz.getId() == cq.quiz.getId()) && (this.client.getId() == cq.client.getId()));
	}
}
